package com.example.tiantian.process;

import java.util.ArrayList;
import java.util.HashMap;

public class MyMap<V> extends HashMap<String, V> {

    private static final long serialVersionUID = 1L;

    ArrayList<String> mKeys;

    public MyMap() {
        super();
        mKeys = new ArrayList<String>();
    }

    @Override
    public int size() {
        return mKeys.size();
    }

    @Override
    public V put(String key, V value) {
        mKeys.add(key);
        return super.put(key, value);
    }

    public String getKey(int index) {
        return mKeys.get(index);
    }

    public V get(int index) {
        return get(getKey(index));
    }

    @Override
    public V remove(Object key) {
        mKeys.remove(key);
        return super.remove(key);
    }

    public V remove(int index) {
        return remove(getKey(index));
    }
}
